package jdbc.lessen02;
import jdbc.lessen02.util.JdbcUtil;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;

/**
 * @Package lessen02
 * @Author shimmer
 * @Date 2020/7/31 9:59
 * @TODO
 */
public class TestInsert {
    public static void main(String[] args) {
        Statement st = null;
        Connection conn = null;
        try {
            conn = JdbcUtil.getConnection();
            st = conn.createStatement();

            //INSERT INTO `user`(`id`,`name`,`pwd`) VALUES('5','www','520');
            String sql = "insert into `user`(`id`,`name`,`pwd`) values('5','www',520)";
            int i = st.executeUpdate(sql);
            if (i > 0) {
                System.out.println("插入成功！");
            }
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            JdbcUtil.release(null, st, conn);
        }

    }
}
